<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>币种编辑</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="/plugins/layui/css/layui.css" media="all"/>
		<link rel="stylesheet" href="/css/global.css" media="all">
		<link rel="stylesheet" href="/plugins/font-awesome/css/font-awesome.min.css">
		<link rel="stylesheet" href="/css/table.css"/>
		<link rel="stylesheet" href="/plugins/layui/css/public.css" media="all" />
		<style>
			.layui-form-label {
				width: 10%;
			}
			.layui-input-block {
				margin-left: 13%;
			}
			.required-field {
				color: red;
				margin-right: 2px;
				font-size: 15px;
				text-align: center;
			}
			img {
				width: 110px;
				height: 110px;
			}
			.layui-upload-list {
				margin-left: 13%;
			}
		</style>
	</head>
	<body>
		<div style="margin: 15px;">
			<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
				<legend>
					币种编辑
				</legend>
			</fieldset>
			<form class="layui-form" id="layui-form" action="/manage/currency/updateCurrency" method="post">
				<input type="hidden" name="id" value="${data.id!}" autocomplete="off" class="layui-input">
				<div class="layui-form-item">
					<label class="layui-form-label layui-required-tip">中文名称：</label>
					<div class="layui-input-block">
						<input type="text" id="coinNameCn" name="coinNameCn" lay-verify="required" value="${data.coinNameCn!}" placeholder="请输入币种名称" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-required-tip">英文名称：</label>
					<div class="layui-input-block">
						<input type="text" id="coinNameEn" name="coinNameEn" lay-verify="required" value="${data.coinNameEn!}" placeholder="请输入币种名称" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-required-tip">货币简称：</label>
					<div class="layui-input-block">
						<input type="text" id="symbol" name="symbol" lay-verify="required" value="${data.symbol!}" placeholder="请输入货币简称" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">所属行业：</label>
					<div class="layui-input-block">
						<select  multiple lay-search name="industryIndustryIds" id="industryIndustryIds">
							<option value="">所属行业</option>
							<#if industList??>
							<#list industList as indust>
								    <#if (indust.isCheck??) && (indust.isCheck==1)>
									<option value="${indust.id}" selected>${indust.industryName!}</option>
								    <#else>
								    <option value="${indust.id}">${indust.industryName!}</option>
								    </#if>
							</#list>
							</#if>
						</select>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">所属概念：</label>
					<div class="layui-input-block">
						<select  multiple lay-search name="industryCategoryIds" id="industryCategoryIds">
							<option value="">所属概念</option>
							<#if conceptList??>
                                <#list conceptList as concept>
                                        <#if (concept.isCheck??) && (concept.isCheck==1)>
                                            <option value="${concept.id}" selected>${concept.conceptCategoryName!}</option>
                                        <#else>
                                            <option value="${concept.id}">${concept.conceptCategoryName!}</option>
                                        </#if>
                                </#list>
							</#if>
						</select>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-required-tip">cmcId：</label>
					<div class="layui-input-block">
						<input type="text" id="cmcId" name="cmcId" lay-verify="required" value="${data.cmcId!}" placeholder="请输入cmcId" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-required-tip">固定换手率：</label>
					<div class="layui-input-block">
						<input type="text" id="fixedTurnoverRate" name="fixedTurnoverRate" value="${data.fixedTurnoverRate!}" lay-verify="required|number" placeholder="请输入固定换手率" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-required-tip">权重：</label>
					<div class="layui-input-block">
						<input type="text" id="fixedWeights" name="fixedWeights" lay-verify="required|number" value="${data.fixedWeights!}" placeholder="请输入固定权重" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">货币诊断：</label>
					<div class="layui-input-block">
						<#if (data.currencyDiagnosisFlag)?? && data.currencyDiagnosisFlag==true>
							<input type="radio" name="currencyDiagnosisFlag" value="1" title="支持" lay-filter="article-type" checked="checked"/>
							<input type="radio" name="currencyDiagnosisFlag" value="0" title="不支持" lay-filter="article-type"/>
							<#else>
								<input type="radio" name="currencyDiagnosisFlag" value="1" title="支持" lay-filter="article-type"/>
								<input type="radio" name="currencyDiagnosisFlag" value="0" title="不支持" lay-filter="article-type" checked="checked"/>
						</#if>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">权重货币：</label>
					<div class="layui-input-block">
						<#if (data.weights)?? && data.weights==true>
							<input type="radio" name="weights" value="1" title="是" lay-filter="article-type" checked="checked"/>
							<input type="radio" name="weights" value="0" title="不是" lay-filter="article-type"/>
							<#else>
								<input type="radio" name="weights" value="1" title="是" lay-filter="article-type"/>
								<input type="radio" name="weights" value="0" title="不是" lay-filter="article-type" checked="checked"/>
						</#if>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">法币：</label>
					<div class="layui-input-block" id="frenchCurrency" >
						<#if (data.frenchCurrency)?? && data.frenchCurrency==true>
								<input type="radio" name="frenchCurrency" value="1" title="支持" checked>
								<input type="radio" name="frenchCurrency" value="0" title="不支持" >
							<#else>
								<input type="radio" name="frenchCurrency" value="1" title="支持" >
								<input type="radio" name="frenchCurrency" value="0" title="不支持" checked>
						</#if>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label layui-required-tip">图标：</label>
					<div class="layui-input-block">
						<button type="button" class="layui-btn" id="test">
							<i class="layui-icon">&#xe67c;</i>图标
						</button>
					</div>
					<div class="layui-upload-list">
						<#if (data.imageUrl)??>
							<img class="layui-upload-img" id="logoImg" src="${data.imageUrl!}" >
						<#else>
							<img class="layui-upload-img" id="logoImg">
						</#if>
						<input type="hidden"  name="imageUrl" id="imageUrl" value="${data.imageKey!}" class="layui-input"/>
						<p id="logoText"></p>
					</div>
				</div>
				<div class="layui-form-item" style="display: none;">
					<label class="layui-form-label layui-required-tip">状态：</label>
					<div class="layui-input-block">
						<#if (data.enableFlag)?? && data.enableFlag==true>
							<input type="radio" name="enableFlag" value="1" title="启用" lay-filter="article-type" checked="checked"/>
							<input type="radio" name="enableFlag" value="0" title="停用" lay-filter="article-type"/>
							<#else>
								<input type="radio" name="enableFlag" value="1" title="启用" lay-filter="article-type"/>
								<input type="radio" name="enableFlag" value="0" title="停用" lay-filter="article-type" checked="checked"/>
						</#if>
					</div>
				</div>

				<!--</div>-->
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
						<button type="button" class="layui-btn layui-btn-primary" onclick="javascript:history.back();" >返回</button>
					</div>
				</div>
			</form>
		</div>
		<script type="text/javascript" src="/plugins/layui/layui.js"></script>
		<script type="text/javascript" src="/js/global-config.js"></script>
		<script>
		layui.config({
			  base: '/js/' //假设这是你存放拓展模块的根目录
			}).extend({ //设定模块别名
			  mymod: 'selectMultiple' //如果 mymod.js 是在根目录，也可以不用设定别名
			});

		layui.use(['layedit', 'laydate','selectMultiple'], function() {
            var form = layui.selectMultiple;
            var $ = layui.jquery;
            var layer = layui.layer; //获取当前窗口的layer对象
            var laydate = layui.laydate;//日期

                form.render();

                layer.ready(function () {
                    var $layer = $('#layui-form');

                    //监听提交监听提交
                    form.on('submit(demo1)', function(data){
						if($("#imageUrl").val()==""){
							layer.msg("请上传图片", { icon: 5, shift: 6 });
							return false;
						}
/*						if(data.field.frenchCurrency == '1'){
						    if(data.field.industryCategoryIds == null){
                                layer.msg("法币概念不能为空", { icon: 5, shift: 6 });
                                return false;
							}
							if(data.field.industryIndustryIds == null){
                                layer.msg("法币行业不能为空", { icon: 5, shift: 6 });
                                return false;
							}
						}*/
						layer.confirm('确认要提交吗？', {
							btn : [ '确定', '取消' ]//按钮
						}, function(index) {
							$layer.submit();
							layer.close(index);
						});
						return false;
                    });
                })
            });
            
            layui.use('upload', function(){
                var upload = layui.upload;
                var $ = layui.jquery
                //执行实例
              //执行实例
                var uploadlogo = upload.render({
                    url: '/manage/upload/uploadFile',
                    elem: '#test', //指定原始元素，默认直接查找class="layui-upload-file"
                    size: 1000,
                    before: function(obj) {
            	        layer.load();
            	    },
                    done: function(res){
                        //上传完毕回调
                        $('#logoImg').attr('src', res.data["imgUrl"]); //图片链接（base64）
                        $('#imageUrl').val(res.data["key"]);
                        layer.closeAll('loading');
                    }
                    ,error: function(){
                        //请求异常回调
                    }
                });
            });
		</script>
	</body>


</html>